# 二维差分数组 区间[x1][y1]-[x2][y2]加上x 处理
def get_diff(diff,x1,y1,x2,y2,x):
    diff[x1][y1]+=x
    diff[x1][y2+1]-=x
    diff[x2+1][y1]-=x
    diff[x2+1][y2+1]+=x

# 还原为原数组--》做前缀和
def pre_sum(a,diff):
    for i in range(1,n+1):
        for j in range(1,m+1):
            a[i][j]=a[i-1][j]+a[i][j-1]-a[i-1][j-1]+diff[i][j]

# 打印二维数组
def output(a):
    for i in range(1,n+1):
        print(' '.join(map(str,a[i][1:])))

n,m=map(int,input().split())
a=[[0]*(m+1) for i in range(n+1)]
diff=[[0]*(m+1) for i in range(n+1)]

for i in range(1,n+1):
    a[i]=[0]+list(map(int,input().split()))

# 差分数组构造
# 由前缀和公式 sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j]
# 把sum 换为a，a换为diff，得 二维差分公式  加 变 减
for i in range(1,n+1):
    for j in range(1,m+1):
        diff[i][j]=a[i][j]-a[i-1][j]-a[i][j-1]+a[i-1][j-1]

# output(diff)
get_diff(diff,2,2,3,3,3)
# output(diff)
# 还原原数组
pre_sum(a,diff)
output(a)
"""
4 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
"""
